#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

#include "uthash.h"

#include <iso646.h>

/**
 * Definition for singly-linked list.
 */
struct ListNode {
	int val;
	struct ListNode* next;
};
typedef struct ListNode list_node, *list_node_ptr;

void reorderList(struct ListNode* head);

int main()
{
	return 0;
}

void reorderList(struct ListNode* head)
{
	list_node aux_reverse = { 0, NULL };
	for (list_node_ptr p = head; p; p = p->next) {
		printf("p:%d\n", p->val);
		list_node_ptr next = p->next;
		if (!next) break;
		p->next = next->next;

		next->next = aux_reverse.next;
		aux_reverse.next = next;
	}

	printf("\n");
	for (list_node_ptr p = head; p; p = p->next->next) {
		printf("p:%d\n", p->val);
		list_node_ptr n = aux_reverse.next;
		aux_reverse.next = n->next;

		n->next = p->next;
		p->next = n;
	}
}
